
package std.env
import std.io.InputStream
import std.sync.*

import std.io.OutputStream
import std.collection.*
import std.fs.*
import std.io.*

@!APILevel[
    since: "22"
]
public class ConsoleReader <: InputStream {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws IllegalMemoryException
    * @throws IllegalSynchronizationStateException
    */
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func read(): ?Rune
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalSynchronizationStateException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func readln(): ?String
    
    /**
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func readToEnd(): ?String
    
    /**
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func readUntil(ch: Rune): ?String
    
    /**
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func readUntil(predicate: (Rune) -> Bool): ?String
    
    /**
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func read(arr: Array<Byte>): Int64
}

@!APILevel[
    since: "22"
]
public class ConsoleWriter <: OutputStream {
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func flush(): Unit
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(buffer: Array<Byte>): Unit
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(buffer: Array<Byte>): Unit
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: String): Unit
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write<T>(v: T): Unit where T <: ToString
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Int8): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Int16): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Int32): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Int64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: UInt8): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: UInt16): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: UInt32): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: UInt64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Float16): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Float32): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Float64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func write(v: Rune): Unit
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: String): Unit
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln<T>(v: T): Unit where T <: ToString
    
    /**
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Int8): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Int16): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Int32): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Int64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: UInt8): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: UInt16): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: UInt32): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: UInt64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Float16): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Float32): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Float64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func writeln(v: Rune): Unit
}

@!APILevel[
    since: "22"
]
public func getProcessId(): Int64

/**
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws EnvException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func getCommand(): String

/**
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws EnvException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func getCommandLine(): Array<String>

/**
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws EnvException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func getWorkingDirectory(): Path

@!APILevel[
    since: "22"
]
public func getHomeDirectory(): Path

/**
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
* @throws IllegalMemoryException
* @throws NoneValueException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func getTempDirectory(): Path

/**
* @throws IllegalMemoryException
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func getVariable(key: String): ?String

/**
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws EnvException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func getVariables(): Array<(String, String)>

/**
* @throws IllegalMemoryException
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func setVariable(key: String, value: String): Unit

/**
* @throws IllegalMemoryException
* @throws IllegalSynchronizationStateException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func removeVariable(key: String): Unit

@!APILevel[
    since: "22"
]
public func getStdErr(): ConsoleWriter

@!APILevel[
    since: "22"
]
public func getStdIn(): ConsoleReader

@!APILevel[
    since: "22"
]
public func getStdOut(): ConsoleWriter

@!APILevel[
    since: "22"
]
public func atExit(callback: () -> Unit): Unit

/**
* @throws OutOfMemoryError
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws EnvException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func exit(code: Int64): Nothing

@!APILevel[
    since: "22"
]
public class EnvException <: Exception {
    @!APILevel[
        since: "22"
    ]
    public init(message: String)
}

